﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;
using PTA;
using System.ComponentModel;
using System.Drawing.Design;

namespace PTA.Web
{
    public class Css : System.Web.UI.Control
    {
        [Bindable(true), DefaultValue(""), Editor("System.Web.UI.Design.UrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
        public string NavigateUrl
        {
            get
            {
                return (string)ViewState["NavigateUrl"] ?? string.Empty;
            }
            set
            {
                ViewState["NavigateUrl"] = value;
            }
        }

        public override void RenderControl(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
            writer.AddAttribute(HtmlTextWriterAttribute.Href, Page.ResolveClientUrl(NavigateUrl));
            writer.RenderBeginTag(HtmlTextWriterTag.Link);
            writer.RenderEndTag();
        }
    }
}
